package com.jianguozh.difs.support.service.utils;

import com.jianguozh.difs.framework.utils.SecurityUtils;
import com.jianguozh.difs.framework.utils.SpringUtils;
import com.jianguozh.difs.support.service.base.service.IParamService;
import com.jianguozh.difs.support.service.base.vo.ParamVo;

/**
 * 参数工具类
 *
 * @author hanrs
 * @email 4076130@qq.com
 * @since 2022/4/6 17:45
 */
public class ParamUtils {

    private static IParamService paramService = SpringUtils.getBean(IParamService.class);

    /**
     * 获取参数值
     *
     * @param paramKey
     * @param actAtOrgId
     * @return
     */
    public static String getParamValue(String paramKey, String actAtOrgId) {
        ParamVo vo = paramService.getVoByKey(paramKey, actAtOrgId);
        return null != vo ? vo.getParamValue() : null;
    }

    /**
     * 获取参数值
     *
     * @param paramKey
     * @return
     */
    public static String getParamValue(String paramKey) {
        return getParamValue(paramKey, SecurityUtils.getLoginUser().getOrgId());
    }

}
